package jodb

import "strings"

type Driver int

const (
	DriverNone Driver = iota
	DriverMySql
	DriverUnsupported
)

func (d Driver) String() string {
	return [...]string{"none", "mysql"}[d]
}

func GetDbDriver(s string) Driver {
	lower := strings.ToLower(strings.TrimSpace(s))

	switch lower {
	case "":
		return DriverNone
	case DriverMySql.String():
		return DriverMySql
	default:
		return DriverUnsupported
	}
}
